package com.qfedu.empproject.utils;


public class Page {
    private Integer pageIndex;  // 当前第几页
    private Integer pageSize;   // 每页几条数据
    private Integer totalCount; // 总共多少条记录
    private Integer totalPage;  // 总共多少页
    private Integer startRow; //起始下标

    public Page(Integer pageIndex, Integer pageSize) {
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getTotalPage() {
        // 总共多少页 21/10
        return totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public Integer getStartRow() {
        return (pageIndex - 1) * pageSize;
    }

    public void setStartRow(Integer startRow) {
        this.startRow = startRow;
    }
}
